import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

//修复路由重复点击报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


import Login from '../views/login/index'
import Index from '../views/index/index'
import Goods from '../views/goods/index'
import HomePage from '../views/homePage/index'
import Order from '../views/order/index'
import Stytem from '../views/stytem/index'



const router = new VueRouter({
  routes: [
    { path: '/', redirect: '/login' },
    { path: '/login', component: Login },
    {
      path: '/index', component: Index,
      children: [
        { path: 'HomePage', component: HomePage },
        { path: 'goods', component: Goods },
        { path: 'order', component: Order },
        { path: 'stytem', component: Stytem },
      ]
    }
  ]
})

export default router
